const path = require('path');

function resolve(dir) {
	return path.join(__dirname, dir)
}
module.exports = {
	runtimeCompiler: true,
	productionSourceMap: false,
	configureWebpack: {
		devtool: 'source-map'
	},
	css: {
		loaderOptions: {
			sass: {
				sassOptions: {
					outputStyle: "expanded"
				},
				additionalData: `@import "@/styles/variables.scss";`,
			}
		}
	},
	chainWebpack(config) {
		config.module.rule('svg').exclude.add(resolve('src/assets/icons')).end()
		config.module.rule('icons').test(/\.svg$/)
			.include.add(resolve('src/assets/icons')).end()
			.use('svg-sprite-loader')
			.loader('svg-sprite-loader')
			.options({ symbolId: 'icon-[name]' }).end()
	},
	devServer: {
		proxy: { //设置代理，必须填
			'/ahla': { //设置拦截器  拦截器格式   斜杠+拦截器名字，名字可以自己定
				// target: 'http://192.168.1.109:9065/ahla', //代理的目标地址
				target: 'http://10.20.30.2:9065/ahla',
				changeOrigin: true, //是否设置同源
				pathRewrite: { //路径重写
					'^/ahla': '' //选择忽略拦截器里面的单词
				}
			}
		}
	}
}